<?php
/**
 * Created by PhpStorm.
 * User: zd
 * Date: 2018/11/14
 * Time: 12:00
 */

namespace app\api\controller\v1;


use app\api\controller\BaseController;
use \app\api\service\Property as PropertyService;
use app\api\validate\IDMustBePositiveInt;
use app\api\validate\PropertyParameter;
use app\lib\exception\ParameterException;
use app\lib\exception\SuccessMessage;

class Property extends BaseController
{
    /**
     * 创建规格
     * @param $category
     * @return \think\response\Json
     * @throws ParameterException
     */
    public function createProperty($id){
        (new PropertyParameter())->goCheck();
        $dataArray = input('post.');
        $service = new PropertyService();
        $result =  $service->createProperty($dataArray,$id);
        if (empty($result)){
            throw new ParameterException();
        }
        return json(new SuccessMessage());
    }
}